// function emptyAction () {
//   // 警告：提示当前使用的是空 Action
//   console.warn('Current execute action is empty!')
// }
// class Actions {
//     // 默认值为空 Action
//     actions = {
//       onGlobalStateChange: emptyAction,
//       setGlobalState: emptyAction
//     };

//     // 设置 actions
//     setActions (actions) {
//       this.actions = actions
//     }

//     // 映射
//     onGlobalStateChange (...args) {
//       return this.actions.onGlobalStateChange(...args)
//     }

//     // 映射
//     setGlobalState (...args) {
//       return this.actions.setGlobalState(...args)
//     }
// }
// const MicroActions = new Actions()
// export default MicroActions

function emptyAction () {
  // 警告：提示当前使用的是空 Action
  console.warn('Current execute action is empty!')
}

class Actions {
    constructor() {
        // 在构造函数里初始化 actions 属性，默认值为空 Action
        this.actions = {
            onGlobalStateChange: emptyAction,
            setGlobalState: emptyAction
        };
    }

    // 设置 actions
    setActions (actions) {
        this.actions = actions;
    }

    // 映射
    onGlobalStateChange (...args) {
        return this.actions.onGlobalStateChange(...args);
    }

    // 映射
    setGlobalState (...args) {
        return this.actions.setGlobalState(...args);
    }
}

const MicroActions = new Actions();
export default MicroActions;